# year = 2000
# i = 0
# while year <= 2050:
#   if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
#     i = i + 1
#     print(year, end = " ")
#   if i % 4 == 0:
#     print()
#   year = year + 1

# 5题
n = eval(input('请输入一个数:'))
for i in range(2, n+1):
  list = []
  for j in range(1, i):
    if i % j == 0:
      list.append(j)
  # print(list)
  if sum(list) == i:
    print(i, end=" ")  
  


# 6题
# sum = 0
# str = input('请输入一个五位数：')
# num = eval(str)
# if len(str) != 5:
#   print('输入的不是五位数！！')
# else:
#   while num != 0:
#     sum = sum * 10 + num % 10
#     num = num // 10
#   if sum == eval(str):
#     print('该数为回文数')
#   else:
#     print('该数不是回文数')

# 7题
# sum = 0
# for i in range(300, 601):
#   n = i
#   s = 0
#   while n != 0:
#     s = s + n % 10
#     n = n // 10
#   if s % 20 == 0:
#     sum = sum + i
# print('累加之和为：', sum)